package com.kmproject.haifu.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.ActivityScope;

import javax.inject.Inject;

import com.kmproject.haifu.mvp.contract.HousePublishDuanZuPublishContract;
import com.kmproject.haifu.mvp.model.api.service.UserService;
import com.kmproject.haifu.mvp.model.entity.ResultBean;
import com.kmproject.haifu.mvp.model.entity.beans.HousePayWayBean;
import com.kmproject.haifu.mvp.model.entity.beans.HouseRentListShowInfoBean;
import com.kmproject.haifu.mvp.model.entity.beans.MyStoryBean;
import com.kmproject.haifu.mvp.model.entity.beans.UserSfBean;
import com.kmproject.haifu.mvp.model.entity.beans.VerificationBean;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 06/26/2019 18:09
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
@ActivityScope
public class HousePublishDuanZuPublishModel extends BaseModel implements HousePublishDuanZuPublishContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;
    UserService  userService;
    @Inject
    public HousePublishDuanZuPublishModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
        userService=repositoryManager.obtainRetrofitService(UserService.class);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<ResultBean<List<HousePayWayBean>>> getHousePayWayBean(String url,String value, String category) {
        return userService.dictList(url,value,category);
    }

//    @Override
//    public Observable<ResultBean<List<HousePayWayBean>>> dictListNew(String url, Map<String, String> params) {
//        return userService.dictListNew(url,params);
//    }

    @Override
    public Observable<ResultBean> addHouseRent(String houseName, String rentType, String houseArea, String lgt, String lat, String acreage, String floor, String totalFloor, double monthRent, double dayRent, double cashPledge, String landlord, String landlordGender, String landlordType, String landlordMobile, String detail, String roomCount, String drawingCount, String toiletCount, String isVerify, String rentRoom, String houseImage, String houseRentDetail) {
        return userService.addHouseRent(  houseName,  rentType,  houseArea,  lgt,
                 lat, acreage,  floor,  totalFloor,
                 monthRent,  dayRent,  cashPledge,  landlord,
                landlordGender, landlordType,  landlordMobile,  detail,
                roomCount,  drawingCount, toiletCount,  isVerify,
                rentRoom,  houseImage,  houseRentDetail);
    }



    @Override
    public Observable<ResultBean<VerificationBean>> sendHouseVerifyCode(String phoneNum) {
        return userService.sendHouseVerifyCode( phoneNum);
    }

    @Override
    public Observable<ResultBean> houseCheckIsCorrectCode(String phoneNum, String identifyCode) {
        return userService.houseCheckIsCorrectCode( phoneNum,  identifyCode);
    }

    @Override
    public Observable<ResultBean<UserSfBean>> getUserShop() {
        return userService.getUserShop();
    }

    @Override
    public Observable<ResultBean<List<HousePayWayBean>>> getAreaTree(String url, String value, String category) {
        return userService.getAreaTree(url,value,category);
    }

    @Override
    public Observable<ResultBean<List<MyStoryBean.ResultBean>>> querySelectStory(Map<String,Object> maps) {
        return userService.querySelectStory(creatRequestBody(maps,mGson));
    }

    @Override
    public Observable<ResultBean<HouseRentListShowInfoBean>> viewHouseRent(String url) {
        return userService.viewHouseRent(url);
    }
}